package org.dwpd.domain.message;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.dwpd.utils.DateUtils;

import java.util.Date;

@Data
@TableName("request_message")
public class HistoryMessage {
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    private Integer fromUserId;
    private String fromUserName;
    private String fromUserImage;
    private Integer messageId;
    private Integer acceptUserId;
    private Integer overFlag;
    private Integer agreeFlag;
    private Integer rejectFlag;
    private String content; // 请求内容
    private Date createTime;

    // 按格式返回创建时间
    public String getCreateTime() {

        if (createTime == null) {
            return DateUtils.dateFormat(new Date(System.currentTimeMillis()));
        }
        return DateUtils.dateFormat(createTime);
    }
}
